A domain delineates the boundaries between a group of objects and their environment. The objects contained in a document are an example of such a group: the document and its components belong to one domain. When an object of a domain has been modified, the other objects of the same domain may be notified by broadcasting a message to them. Normally, such a broadcast is limited to the same domain. In exceptional cases, messages may be broadcast to several domains, in which case the message source is called a "shared" domain.
Apart from reducing message traffic, domains may have other purposes as well: if the objects in a domain are persistent (-> 5.4 "Stores"), the domain defines which objects are stored in a particular file and which are not.
For documents, a domain is also the scope for undo/redo operations: every document domain manages its own undo/redo stacks for operations.
CONST exclusive, shared
Constants which can be passed to the shared parameter of procedure Domain.Init. Most domains are exclusive.
TYPE Message
Interface
This is the base type of messages to be broadcast in one (or sometimes in several) domains.
Messages are used internally.
Messages are extended internally.
TYPE Domain
Interface
Domains define boundaries around objects, they define which objects are "inside" and which are "outside" from their point of view.
Domains are used in Stores (-> 5.4) to define groups of persistent objects. Each document belongs to at most one domain, notification messages are broadcast in one or several domains, and undo/redo is performed on a per-domain basis.
init-: BOOLEAN
Flag which tells whether the domain has been initialized already.
shared-: BOOLEAN
Flag which tells whether the domain is shared or exclusive.
PROCEDURE (d: Domain) Handle (VAR msg: Message)
Empty
Message handler for a domain.
Handle is called internally.
Handle is extended internally.
PROCEDURE (d: Domain) Init (shared: BOOLEAN)
This procedure sets a domain to either shared or exclusive state.
Init is called internally.
Init is not extended.
~d.init 20
d.init
d.shared = shared
TYPE OpName
String type for the name of an operation.
TYPE Operation
Operations are objects which perform modifications on other objects. All objects modified by the operation must belong to the same domain. The operation's Do procedure performs the desired modification, and must be involutory, i.e. when called twice, its effect must have been neutralized again.
inUse-: BOOLEAN
Tells whether the operation is alreay in use by a domain.
name-: OpName
The operation's name.
PROCEDURE (op: Operation) Do
Interface
This procedure performs a modification on other objects. It must be involutory, i.e. it must have the identical effect if called an odd number of times, and no effect if called an even number of times.
Do is called internally.
Do must be extended by every concrete operation; many model (-> 5.6) and view (-> 5.7) modifications are implemented as operations.